package com.sgb.kjwl.view.ui.adapter.home;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemSearchCompanyBinding;
import com.sgb.kjwl.model.entity.BossEntity;
import com.sgb.kjwl.model.entity.StoreEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class SearchCompanyAdapter extends BaseRecycleAdapter<StoreEntity> {
    private ItemShow showview;

    public SearchCompanyAdapter(Context context, List<StoreEntity> datas) {
        super(context, R.layout.item_search_company, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final StoreEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        ItemSearchCompanyBinding itemSearchCompanyBinding = (ItemSearchCompanyBinding) holder.getmBinding();
        itemSearchCompanyBinding.imageZiying.setVisibility(entity.getSelfSupportTag() == 1 ? View.VISIBLE : View.GONE);
        if (TextUtils.isEmpty(entity.getAuthYear())) {
            holder.getView(R.id.authYear).setVisibility(View.GONE);
        } else {
            holder.getView(R.id.authYear).setVisibility(View.VISIBLE);
        }
    }

    public interface ItemShow {
        void show();

    }

    public void setItemShow(ItemShow listener) {
        this.showview = listener;
    }
}
